//
// Created by keep on 17-9-28.
//

#ifndef TEST1_UART_H
#define TEST1_UART_H

#include     <stdio.h>      /*标准输入输出定义*/
#include     <stdlib.h>     /*标准函数库定义*/
#include     <unistd.h>     /*Unix 标准函数定义*/
#include     <sys/types.h>
#include     <sys/stat.h>
#include     <fcntl.h>      /*文件控制定义*/
#include     <termios.h>    /*PPSIX 终端控制定义*/
#include     <errno.h>      /*错误号定义*/

#ifdef __cplusplus
extern "C"{
#endif

int open_uart(const char *dev);
int close_uart(int fd);
int reopen_uart(const char *dev, int fd);
size_t        /* Read "n" bytes from a descriptor */
readn(int fd, void *ptr, size_t n);
ssize_t        /* Write "n" bytes to a descriptor */
writen(int fd, const void *ptr, size_t n);

ssize_t tread(int fd, void *buf, size_t nbytes, unsigned int timout);
ssize_t treadn(int fd, void *buf, size_t nbytes, unsigned int timout);
#ifdef __cplusplus
}
#endif

#endif //TEST1_UART_H
